package a;
import java.util.Arrays;
import java.util.stream.*;

public class BigDataExample {
    public static void main(String[] args) {
        // 生成包含1000万个整数的数据集
        int[] data = new int[10000000];
        for (int i = 0; i < data.length; i++) {
            data[i] = i;
        }

        // 将数据集转换为IntStream
        IntStream stream = Arrays.stream(data);

        // 计算平均值和总和
        double average = stream.average().getAsDouble();
        int sum = stream.sum();

        // 输出结果
        System.out.println("Average: " + average);
        System.out.println("Sum: " + sum);
    }
}


